<!--
<script id="twitter-wjs" src="../static/widgets.js"></script>
<script async="" src="../static/analytics.js"></script>
<script type="text/javascript" src="../static/jquery.min.js"></script>
<script type="text/javascript" src="../static/jquery.colorbox-min.js"></script>
<link rel="stylesheet" type="text/css" href="../static/colorbox.css" media="screen">
-->
<link href="css/sexyalertbox.css" rel="stylesheet" type="text/css" media="screen" />
<script src="js/alertbox.js" type="text/javascript"></script>
<div id="container-wrapper">
    <div id="container">
        <div id="scroll-down-target"></div> <!-- This is Flexslider scroll down button target -->


        <!-- Begin notifications -->
        <div id="notification-fixed">
            <div id="notification"></div>
        </div>
        <!-- End notifications -->

        <div id="column-right">

            <!-- Begin scroll down button script -->
           
            <!-- End scroll down button script -->    <div class="box">
                <div class="box-heading"><span class="specials">Giảm giá</span></div>
                <div class="box-content">
                    <div class="box-product">
                        <?php
                            $sp_khuyenmai=$modelSanPham->List_SPKhuyenMai();
                            while ($row_spkm=  mysql_fetch_assoc($sp_khuyenmai)){
                        ?>
                        <!-- Begin box-product div -->
                        <div>

                            <!-- Begin boxgrid -->
                            <div class="boxgrid">
                                <div class="image"><a href="sanpham/<?php echo $row_spkm['ten_sp_kd']?>-<?php echo $row_spkm['sp_id']; ?>.html"><img width="65" height="65" src="<?php echo $row_spkm['hinh_dai_dien']; ?>" alt=""></a></div>
                                <!-- Begin box-product-info -->
                                <div class="box-product-info">
                                    <div class="thumbnail-buttons">
                                        <div class="more"><a href="sanpham/<?php echo $row_spkm['ten_sp_kd']?>-<?php echo $row_spkm['sp_id']; ?>.html" oldtitle="View More" title=""></a></div>
                                        <div class="cart"><input type="button" value="Add to Cart" onclick="addToCart( & #39; 42 & #39; );" class="button-cart" oldtitle="Add to Cart" title=""></div>
                                        
                                    </div>
                                </div>
                                <!-- End box-product-info -->
                            </div>
                            <!-- End boxgrid -->

                            <!-- Begin boxgrid-bottom -->
                            <div class="boxgrid-bottom">
                                <div class="arrow-box"></div>
                                <div class="name"><a href="sanpham/<?php echo $row_spkm['ten_sp_kd']?>-<?php echo $row_spkm['sp_id']; ?>.html"><?php echo $row_spkm['ten_sp']; ?>"</a></div>
                                <div class="price">
                                    <span class="price-old"><?php echo number_format($row_spkm['gia'].' VNĐ'); ?></span>
                                    <span class="price-new">
                                        <?php 
                                           $giacu=$row_spkm['gia'];
                                           $khuyenmai=$row_spkm['khuyen_mai'];
                                           echo number_format($giamoi=$giacu-($giacu*$khuyenmai/100));
                                       ?>                                       
                                    </span>
                                    <div class="ribbon-sale">Giãm<?php echo $khuyenmai=$row_spkm['khuyen_mai'].'%'; ?></div>
                                </div>
                            </div>
                            <!-- End boxgrid-bottom -->

                        </div>
                        <?php } ?>

                    </div>
                </div>
            </div>    <div class="box">
                <div class="box-heading"><span class="latest">Có thể bạn thích</span></div>
                <div class="carousel-box-content">
                    <div id="carousel200">
                        <div class=" jcarousel-skin-opencartfc"><div class="jcarousel-container jcarousel-container-horizontal" style="position: relative; display: block;"><div class="jcarousel-clip jcarousel-clip-horizontal" style="position: relative;"><ul class="jcarousel-list jcarousel-list-horizontal" style="overflow: hidden; position: relative; top: 0px; margin: 0px; padding: 0px; left: -1935px; width: 2150px;">
                                        <?php 
                                           echo  $loai_id=$row_sp['loai_id'];
                                            $sp_thich=$tc->sanpham_cothethich($loai_id);
                                            while ($row_spthich=  mysql_fetch_assoc($sp_thich)){
                                        ?>
                                        <li class="jcarousel-item jcarousel-item-horizontal jcarousel-item-1 jcarousel-item-1-horizontal" jcarouselindex="1" style="float: left; list-style: none; width: 215px;">

                                            <div class="box-product">
                                                <!-- Begin box-product div -->
                                                <div>
                                                    <!-- Begin boxgrid -->
                                                    <div class="boxgrid">
                                                        <div class="image"><a href="sanpham/<?php echo $row_spthich['ten_sp_kd']?>-<?php echo $row_spthich['sp_id']; ?>.html"><img width="215" height="215" src="<?php echo $row_spthich['hinh_dai_dien']; ?>" alt="Samsung Galaxy Tab"></a></div>
                                                        <!-- Begin box-product-info -->
                                                        <div class="box-product-info">
                                                            <div class="thumbnail-buttons">
                                                                <div class="more"><a class="fancybox" href="<?php echo $row_spthich['hinh_dai_dien']; ?>" title="<?php echo $row_spthich['ten_sp']; ?>"></a></div>
                                                                <div class="cart"><a href="sanpham/<?php echo $row_spthich['ten_sp_kd'] ?>-<?php echo $row_spthich['sp_id']; ?>.html" title="Mua liền"><input type="button"  class="button-cart"  title="Mua liền"></a></div>
                                                               
                                                            </div>
                                                        </div>
                                                        <!-- End box-product-info -->
                                                    </div>
                                                    <!-- End boxgrid -->

                                                    <!-- Begin boxgrid-bottom -->
                                                    <div class="boxgrid-bottom">
                                                        <div class="arrow-box"></div>
                                                        <div class="name"><a href="sanpham/<?php echo $row_spthich['ten_sp_kd']?>-<?php echo $row_spthich['sp_id']; ?>.html"><?php echo $row_spthich['ten_sp']; ?></a></div>
                                                        <div class="price">
                                                            <?php echo number_format($row_spthich['gia']).' VNĐ'; ?>						          								        	</div>

                                                    </div>
                                                    <!-- End boxgrid-bottom -->
                                                </div>
                                                <!-- End box-product div -->
                                            </div>

                                        </li>
                                            <?php } ?>
                                    </ul></div><div class="jcarousel-prev jcarousel-prev-horizontal" style="display: block;"></div><div class="jcarousel-next jcarousel-next-horizontal jcarousel-next-disabled jcarousel-next-disabled-horizontal" disabled="disabled" style="display: block;"></div></div></div>
                    </div>
                </div>
            </div>
            <script type="text/javascript"><!--
            function mycarousel_initCallback(carousel)
                        {
                        // Disable autoscrolling if the user clicks the prev or next button.
                        carousel.buttonNext.bind('click', function() {
                        carousel.startAuto(0);
                        });
                                carousel.buttonPrev.bind('click', function() {
                                carousel.startAuto(0);
                                });
                                // Pause autoscrolling if the user moves with the cursor over the clip.
                                carousel.clip.hover(function() {
                                carousel.stopAuto();
                                }, function() {
                                carousel.startAuto();
                                });
                        };
                        $('#carousel200 ul').jcarousel({
                initCallback: mycarousel_initCallback,
                        animation: 1000,
                        vertical: false,
                        easing: "easeInOutQuad",
                        wrap: 'both',
                        auto:  1,
                        visible: 1,
                        scroll: 1});//--></script>

             </div>

        <!-- Begin content //-->
        <div id="content">

            <!-- Begin breadcrumb -->
            <div class="breadcrumb">
                <a href="index.php">Trang chủ</a>
                » <a href="">sản phẫm</a>
                » <a href=""><?php echo $row_sp['ten_sp']; ?></a>
            </div>
            <!-- End breadcrumb -->


            <!-- Begin product-info //-->
            <div class="product-info">

                <!-- Begin left area //-->
                <div class="left">

                    <!-- Begin product image //-->
                    <div class="image">
                        <div id="wrap" style="top:0px;z-index:9;position:relative;">
                            <a href="<?php echo $row_sp['hinh_dai_dien']; ?>" class="cloud-zoom" id="zoom1" rel="adjustX: 0, adjustY:0" style="position: relative; display: block;">
                                <img width="420" height="420" src="<?php echo $row_sp['hinh_dai_dien']; ?>"  id="image" style="display: block;">
                            </a>
                            <div class="mousetrap" style="background-image: url(); z-index: 999; position: absolute; width: 420px; height: 420px; left: 0px; top: 0px; cursor: move;"></div>
                                
                        </div>
                        <div class="zoom"><a id="zoomer" class="colorbox cboxElement" href="<?php echo $row_sp['hinh_dai_dien']; ?>" oldtitle="Zoom" title=""></a></div>


                    </div>
                    <!-- End product image //-->

                    <!-- Begin additional images //-->
                    <div class="image-additional">
                        <?php 
                                                        
                            $url=$row_sp['hinh_anh'];                                                        
                            $url= explode(';',$url);
                           // echo $url[0];
                           // print_r($url);
                            $dem=count($url);
                           for($i=0;$i<$dem;$i++){
                        ?>
                        <a href="<?php echo $url[$i]; ?>" class="cloud-zoom-gallery" rel="useZoom: &#39;zoom1&#39;, smallImage: &#39;<?php echo $url[$i]; ?>&#39; "><img src="<?php echo $url[$i]; ?>" width="82" height="82" alt="iPhone"></a>
                        <?php } ?>
                    </div>
                    <!-- End additional images //-->

                </div>
                <!-- End left area //-->

                <!-- Begin right area //-->
                <div class="right">

                    <div class="heading-product"><h1><?php echo $row_sp['ten_sp']; ?></h1></div>

                    <!-- Begin description //-->
                    <div class="description">
                        <?php echo $row_sp['mo_ta']; ?>     </div>
                    <!-- End description //--> 

                    <!-- Begin price //-->      
                    <div class="price-container">
                        <div class="price">Giá:                
                            <?php 
                                $giacu=$row_sp['gia'];
                                $khuyenmai=$row_sp['khuyen_mai'];
                                echo number_format($giamoi=$giacu-($giacu*$khuyenmai/100)).' VNĐ'; 
                            ?>              
                        </div>
                    </div>
                    <!-- End price //-->
                    <div>
                        <label class=""><em style="color: red;">*</em><b>Màu sắc</b></label>
                        <div class="input-box">
                            <select class=" required-entry product-custom-option" id="color" name="color">
                                <option value="">-- Chọn màu --</option>
                                <?php
                                $list_mau = $tc->getListMauByProductId($sp_id);
                                while ($row_m = mysql_fetch_assoc($list_mau)) {
                                    $chitiet_m = $tc->getDetailMau($row_m['mau_id']);
                                    $row_mau = mysql_fetch_assoc($chitiet_m);
                                    ?>
                                    <option value="<?php echo $row_mau['mau_id']; ?>"><?php echo $row_mau['ten']; ?> </option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <div style="margin-top: 10px;">
                        <label class=""><b><em style="color: red;">*</em>Size-----
                                <a class="fancybox" href="static/tip-sizeao.jpg" title="Hướng dẩn cách chọn size">Hướng dẩn cách chọn size</a></b></label>
                        <div class="input-box">
                            <select  class=" required-entry product-custom-option" id="sizechoose" name="sizechoose">
                                <option value="">-- Chọn size --</option>
                                <?php
                                $list_size = $tc->getListSizeByProductId($sp_id);
                                while ($row_s = mysql_fetch_assoc($list_size)) {
                                    $chitiet_s = $tc->getDetailSize($row_s['size_id']);
                                    $row_size = mysql_fetch_assoc($chitiet_s);
                                    ?>
                                    <option value="<?php echo $row_size['size']; ?>"><?php echo $row_size['size']; ?> </option>
                                <?php } ?>
                            </select>
                            
                        </div>
                        
                    </div>
                   
                    <div  class="cart">
                        <!-- Begin quantity //-->
                        
                        <!-- End quantity //-->
                        <!-- Begin add to cart button //-->
                        
                        <input  type="button" value="Mua liền" id="btnAdd" class="button-product-page btn-cart">
                        <a href='gio-hang.html'><input  class="button-product-page btn-cart" id="btnThanhtoan" value="Tính tiền" type="button" style='display: none' ></a>
                        <!-- End add to cart button //-->
                        <!-- Begin compare / wishlist //
                        <div class="product-add-list-compare">
                            <a class="product-add-to-wishlist" onclick="addToWishList( & #39; 40 & #39; );">Add to Wish List</a>&nbsp;&nbsp;&nbsp;
                            <a class="product-add-to-compare" onclick="addToCompare( & #39; 40 & #39; );">Add to Compare</a>
                        </div> 
                        <!-- End compare / wishlist //-->
                    </div>
                    <!-- End cart //-->

                    <!-- Begin review //-->
                    <div class="review">
                      
                        <div class="share"><!-- AddThis Button BEGIN -->
                            <div class="addthis_default_style"><a class="addthis_button_compact at300m" href="#"><span class="at16nc at300bs at15nc at15t_compact at16t_compact"><span class="at_a11y">More Sharing Services</span></span>Share</a> <a class="addthis_button_email at300b" target="_blank" title="Email" href="#" tabindex="1000"><span class="at16nc at300bs at15nc at15t_email at16t_email"><span class="at_a11y">Share on email</span></span></a> <a class="addthis_button_facebook at300b" title="Facebook" href="#"><span class="at16nc at300bs at15nc at15t_facebook at16t_facebook"><span class="at_a11y">Share on facebook</span></span></a> <a class="addthis_button_twitter at300b" title="Tweet" href="#"><span class="at16nc at300bs at15nc at15t_twitter at16t_twitter"><span class="at_a11y">Share on twitter</span></span></a></div>
                            <script type="text/javascript" src="static/addthis_widget.js"></script><div id="_atssh" style="visibility: hidden; height: 1px; width: 1px; position: absolute; z-index: 100000;"><iframe id="_atssh711" style="height: 1px; width: 1px; position: absolute; z-index: 100000; border: 0px; left: 0px; top: 0px;" oldtitle="AddThis utility frame" title="" src="static/sh142.htm"></iframe></div><script type="text/javascript" src="static/core112.js"></script> 
                            <!-- AddThis Button END --> 
                        </div>
                    </div>
                    <!-- End review //-->
                </div><!-- End right area //-->
            </div><!-- End product-info //-->

            <!-- Begin tabs //-->
            <div id="tabs" class="htabs">
                <ul>
                    <li><a href="#tab-description" class="selected"><span class="tab-description2">Chi tiết</span><span class="arrow-down"></span></a></li>
                    <li><a href="#tab-review" class=""><span class="tab-review2">Đánh giá</span><span class="arrow-down"></span></a></li>
                </ul>
            </div>

            <!-- Begin tabs content //-->


            <div id="tab-description" class="tab-content" style="display: block;">
                <?php echo $row_sp['chi_tiet']; ?>
            </div>

            <!-- Begin tabs review //-->
            <div id="tab-review" class="tab-content" style="display: none;">
                <div id="review">
                    <?php include 'blocks/facebook-comment.php'; ?>
                </div>
                
            </div>
            <!-- End tabs review //-->
            <!-- End tabs content //-->
            <!-- End tabs //-->

            <!-- Begin tags -->
            <div class="tags"><b>Tags:</b>
                <a href="index.php?route=product/search&tag=lorem">lorem</a>,
                <a href="index.php?route=product/search&tag=ipsum">ipsum</a>,
                <a href="index.php?route=product/search&tag=dolor">dolor</a>,
                <a href="index.php?route=product/search&tag=sit">sit</a>,
                <a href="index.php?route=product/search&tag=amet">amet</a>
            </div>
            <!-- End tags -->

            <!-- Begin related products //-->

            <!-- End box -->
            <!-- End related products //-->


        </div>
        <!-- End content //-->

        
       

        <script type="text/javascript"><!--
                    $('#tabs a').tabs();//--></script>
        
        <!-- Begin Quantity Plus/Minus Buttons Script //-->
        <script type="text/javascript">
        jQuery(document).ready(function(){
            // This button will increment the value
            $('.qtyplus').click(function(e){
                // Stop acting like a button
                e.preventDefault();
                // Get the field name
                fieldName = $(this).attr('field');
                // Get its current value
                var currentVal = parseInt($('input[name='+fieldName+']').val());
                // If is not undefined
                if (!isNaN(currentVal)) {
                    // Increment
                    $('input[name='+fieldName+']').val(currentVal + 1);
                } else {
                    // Otherwise put a 1 there
                    $('input[name='+fieldName+']').val(1);
                }
            });
            // This button will decrement the value till 1
            $(".qtyminus").click(function(e) {
                // Stop acting like a button
                e.preventDefault();
                // Get the field name
                fieldName = $(this).attr('field');
                // Get its current value
                var currentVal = parseInt($('input[name='+fieldName+']').val());
                // If it isn't undefined or its greater than 1
                if (!isNaN(currentVal) && currentVal > 1) {
                    // Decrement one
                    $('input[name='+fieldName+']').val(currentVal - 1);
                } else {
                    // Otherwise put a 1 there
                    $('input[name='+fieldName+']').val(1);
                }
            });
        });
        </script>
<!-- End Quantity Plus/Minus Buttons Script //-->
      

        

        <script type="text/javascript">
                    function printpage()
                    {
                    window.print();
                    }
        </script>


       

    </div><!-- End container //-->
</div><!-- End container wrapper //-->
<script type='text/javascript'>
$(function(){    
   $('#btnAdd').click(function(){
       //alert('a');
     if($('#color').val()==0 || $('#sizechoose').val()==0){
         Sexy.alert('<p style="padding-top:20px">Vui lòng chọn đầy đủ màu và size!</p>');
     }else{
         $.ajax({
            url: 'ajax/process_cart.php',
            type: "POST",
            data: {
                action: 'add',
                mau_id : $('#color').val(),
                size :$('#sizechoose').val(),
                soluong :$('#soluong').val(),
                sp_id : <?php echo $sp_id; ?>
            },
            success: function(data) {
                Sexy.alert('<p style="padding-top:20px">Thành công: Bạn có muốn tới <a href="gio-hang.html">giỏ hàng</a> !</p>');
                $('#btnThanhtoan').fadeIn(500);
            }
         });
     }
   });
});
</script>